using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Pex.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CoreRay.Testing
{
    [TestClass, PexClass]
    public partial class Vector3TestPex
    {
        [PexMethod]
        public void MagnitudeTest(Vector3 target)
        {
            Assert.AreEqual<float>((float)System.Math.Sqrt(target.X * target.X + target.Y * target.Y + target.Z * target.Z), target.Magnitude);
        }


        [PexMethod]
        public void NormalizeTest(Vector3 target)
        {
            float temp = 1.0f / target.Magnitude;
            Vector3 expected = new Vector3(target.X * temp, target.Y * temp, target.Z * temp);

            Assert.AreEqual(expected, target.Normalize());
        }

        [PexMethod]
        public void ComputeAngleTest(Vector3 vector1, Vector3 vector2)
        {
            float actual = Vector3.ComputeAngle(vector1, vector2);
            float expected = (float)System.Math.Acos((vector1 * vector2) / (vector1.Magnitude * vector2.Magnitude));

            Assert.AreEqual(expected, actual);
        }
    }
}
